package com.ming.elm.dao;

import com.ming.elm.po.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface UserDao {

	@Select("select * from user where userId=#{userId} and password=#{password}")
	public User getUserByIdByPass(@Param("userId") String userId,@Param("password") String password) throws Exception;

	@Select("select * from user where userId = #{userId}")
	public User getUserById(String userId) throws Exception;

	@Insert("INSERT INTO USER(`userId`,`password`,`userName`,`userSex`,`delTag`) " +
			"VALUES (#{userId},#{password},#{userName},#{userSex},1);")
	public int saveUser(User user) throws Exception;

	@Update("update user set userImg = #{userImg} where userId = #{userId}")
	public int updateUserImg(User user) throws Exception;

	@Update("update user set password = #{password} where userId = #{userId}")
	public int updatePwd(User user) throws Exception;
}
